JBoss Fuse Technology Overview

Red Hat JBoss Fuse Integration Partner Day

Charles Moulliard (@cmoulliard)
Principal Solution Architect / Apache Committer - Global Partner Enablement

13th of May - 2014

Projects timeline

  • A few things about Fuse & OpenSource

HistoryOfFuse

Common pattern

producer-consumer

  • Decouple Producer from Consumer

  • Message transport information

  • Goal : Isolate applications from each/other, integrate them

Point to Point topology

  • Producer sends messages to a queue (using JMS API).

  • Consumer listens for messages from the queue

  • Messages are stored until read (or expired)

  • Messages can be persisted, are read only once.

point to point

Publish To Subscribe

  • A client sends message to the topic.

  • Broker sends message to all subscribers that are currently alive.

  • Messages are consumed x times (relation 1 to many)

publish subscribe

ActiveMQ

  • Middleware broker High performance, reliable JMS messaging fabric

  • Supporting JMS, C, C++, .Net, Stomp, AMQP clients

  • Protocols : TCP/SSL/HTTP/HTTPS/WebSocket …

broker-architecture

Master/Slave

  • High-Availability / Failover

  • Brokers compete to acquire lock - FS/DB

master-slave

Network of Brokers

  • Forward messages

  • Loadbalancing, isolate brokers - security, …

network-of-broker

JBoss A-MQ

  • An open source messaging platform

rh jboss amq

ActiveMQ in action

  • DEMO :

    • Create dynamically a queue

    • Publish message

What about Bus ?

bus1

  •    Complex use cases    correlation, orchestration, routing, mediation, transformation

  •    Layer to exchanges messages    BUS

  •    Ideas Implemented into ESB

ESB & JBI

esb1 esb

  • Services & Components communicate using NMR bus

  • Packaged as zip (=SU) in a big zip (=SA) including xml config, target service

  • Constraint : messages formated as XML

  •    EIP not included in the spec

Apache Camel

camel box small
  • Opensource    Java Integration Framework

  • Designed around    Domain Specific Language

  • Implements Enterprise Integration Patterns

book

Enterprise Patterns

  • > 50 patterns implemented

  • and more : Loadbalancer, Throttler, Delayer, …

patterns
patterns 3

Key concepts

factory

  • Component

  • Endpoint

  • Consumer

  • Producer

Route, processor

  • Camel project    collection of routes

  • Route    Processors + Interceptors

pipeline

Interceptor

  • To trace, log, capture business events

pipeline2

Container

camel-features

  • Routes/Endpoints registered    CamelContext

  • Policy, Threads can be configured

Communication

camel-features2

  • Cross communication not allowed between context

Extend the BUS

camel-features3

  • But possible Using BUS like NMR, Broker, Shared Component with direct-vm, vm

Convert

type-converter

  • Type Converter Strategy

  • Allow to convert the body payloads from one type to another

  • To and From these types

    • File

    • String

    • byte[] and ByteBuffer

    • InputStream and OutputStream

    • Reader and Writer

Convert

  • Data Transformation for complex use case

package org.devnation.camel;

import java.io.InputStream;
import java.io.OutputStream;
import org.apache.camel.Exchange;

public interface DataFormat {

    void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception;

    Object unmarshal(Exchange exchange, InputStream stream) throws Exception;
}
  • Marshalling : Object XML (JAXB)

  • Unmarshalling : XML Object (JAXB)

Data Format supported

dataformat 2

Fire / Forget pattern

inonly

Request / Reply pattern

inout

Java DSL

  • Fluent API

package org.devnation.camel;

import org.apache.camel.builder.RouteBuilder;

public class ExampleRouteBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {

        from("amq:queue:quotes")
           .filter().xpath("/quote/product/ = 'widget")
                .bean("QuotesService", "widget")
           .filter().xpath("/quote/product/ = 'gadget")
                .bean("QuotesService","gadget");

    }
}

XML, XML

  • Alternative : Spring, Blueprint DSL

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
    <bean id="quotesService" class="org.devnation.camel.QuotesService"/>"

    <camelContext  xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="amq:queue:quotes"/>
            <filter>
                <xpath>"/quote/product/ = 'widget"</xpath>
            </filter>
                <bean id="quotesService" method="widget"/>
            <filter>
                <xpath>"/quote/product/ = 'gadget"</xpath>
            </filter>
            <bean id="quotesService" method="gadget"/>
        </route>
    </camelContext>

</beans>

Facts

  • Small bus / alternative to bigger bus like JBI, SCA, NMR

  • Support object : XML, File, Stream, Bytes

  • Predicate & Expression language (xslt, xpath, …)

  • Sync/Async exchanges

  • Threads Management,

  • Tx Architecture

  • Error & exception handling

  • Policy driven

  • Container agnostic

Components

components

Apache CXF

  • Goal Simplify creation & deployment of web/REST services

  • 2 approaches java wsdl or wsdl java

  • Support :

    • JAX-WS : Web Services (XML/SOAP)

    • JAX-RS : REST service (JSON)

    • SOAP 1.1, 1.2, WSDL 1.1, WS-Security, WS-Addressing, WS-RM

fabric cxf

Maven plugin

  • cxf-codegen-plugin & cxf-java2ws-plugin

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.version}</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/resources/myService.wsdl</wsdl>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Integration with Camel

  • Define a Camel CXF Endpoint, use it from your camel route <from uri="cxf:bean:reportIncident"/>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
...

<cxf:cxfEndpoint id="reportIncident"
    address="http://localhost:{{port}}/camel-example/webservices/incident"
    wsdlURL="etc/report_incident.wsdl"
    serviceClass="org.apache.camel.example.ReportIncidentEndpoint"/>
...

<route>
      <from uri="cxf:bean:reportIncident"/>
      <convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident"/>
      <transform>
        <method bean="responseBean" method="getOK"/>
      </transform>

JBoss Fuse

rh jboss fuse
  • Enables integration & Mediation everywhere for a real-time enterprise

Apache Karaf karaf-logo

  • Java OSGI Runtime

  • Offer modularity for Integration

  • Multi-Technology platform

ship containers

Architecture

karaf

  • Technology    Camel, CXF, ActiveMQ, Spring, Fabric, …

  • Modular platform    deploy or remove container/libraries

Core features

  • SSH server

  • Allow to administrate/create instances

  • Provide provisioning solution features

  • Hot deployment

  • Configure & manage instances

  • Security integration - JAAS

Karaf in action

  • DEMO :

    • Admin

    • Provisioning

Integration container

  • Camel routes isolated from each other (classloader)

  • Bundle    CamelContext boundaries    Local BUS

  • Camel routes    can have different SLA (Threads, Policies, …)

karaf1

Integration container

  • Camel routes can be started/stopped/updated

  •    Simplify maintenance process

karaf2

Integration container

  • New routes can be hot deployed

  • Like also "Beans/POJO, Web Services, …"

karaf3

Karaf & Camel in action

  • DEMO :

    • Hot Deployment

Integration complexity

karaf5

  • Karaf is not the only container

  • Can we support other Java container using Fuse ?

    • Web / JavaEE

    • Java Micro container

    • Docker …

Integration everywhere

karaf4

  • Infrastructure :

    • Local

    • Remote

    • Virtual Machines

    • Iaas/Paas

    •    xPaas

  • Do you support such ecosystem ?

  • How can we manage hybrid inf. (config, ip, provisioning) ?

Fabric8

  • Opensource integration project - http://fabric8.io

  • Mission    Easy to deploy your java integration solutions and services on a number of machines, processes and JVMs

fabric diagram

Features

  • Manage container creation (locally, remotely, cloud, openshift, docker, …)

  • Visualise what is running to understand your platform

  • Monitor whats running and easily scaling up or down specific profiles

  • Make configuration, composition or version changes in an all-in-one approach or via rolling upgrades

  • Virtualize services (endpoints), processes

  • Search and storage engine (insight) for logs, metrics

Karaf limitations

fabric-3

  • Karaf can create new instances (locally) & administrate them (locally or remotely)

  • Instances are not cloned   

  • Configurations must be managed (manually, script)

Fabric extends the possibilities

fabric-diagram1

Coordinating system : Zoo

  • Rely on    Zookeeper server (ensemble of 1,3, 5 or servers)   

  • Coordinating distributed systems in a reliable way (electing leaders, implementing master/slave, sharding or federation of services).

fabric-1

Fabric Agents

  • Are the clients of the Zookeeper server(s)

fabric-2

  • They will communicate with Zk server to :

  •    register container info (ports, services, endpoints, processes)

  •    get their provisioning

Profiles

  • Behavior of a container

  • Envelope(s) containing artifacts to be deployed, parameters (system, jvm, services) to be configured

  • Can be versioned, facilitate mngt - rollback

fabric 5

Virtualization & Load balancing

  •    Create indirection points, Easy elastic scaling of services (Camel, CXF, …)

fabric camel

High Availability

  • New topologies (Replicated - LevelDB storage, NPlus1),

  • Broker discovery

fabric activemq

Metrics

  • Fabric Insight Technology   

    • NoSQL storage for JSon documents

    • Based on ElasticSearch

elasticsearch1
float

Dashboard

  • Kibana is the web front end

kibana3
  • Full Text Search features   

lucene logo

Info collected

400

  • Logs, Camel metrics, JMX metrics, your own data/JSON metrics

import org.apache.camel.Header;
import org.fusesource.insight.storage.StorageService;
import java.sql.Timestamp;
import java.util.Date;

public class StoreService {

    private static String ES_TYPE = "insight-tweet";
    private static StorageService storageService;

    public static void store(@Header("tweet-full") String data) {
        storageService.store(ES_TYPE, generateTimeStamp(), data);
    }

Analyzed using kibana

80%

Insight Camel

80%

Hawtio

hawtio-logo-bigger

  • Lightweight & modular HTML5 web console with plugins for managing Java MBeans

  • Javascript / REST front end    jolokia JMX translator

  • Heart of the new Fuse Management Console

  • 100    100    100    150

Pluggable Management Console

hawtio-2

Discover your camel routes

hawtio-3

Manage your brokers

hawtio-4 hawtio-5

Demos

JBoss Fuse

POJO + Messaging + Web

JBoss A-MQ

High Availability with Network of Brokers

JBoss Fuse + Fabric

Virtualization of Camel endpoints / loadbalancing

Questions

questions

  • Twitter : @cmoulliard

  • More info   

    • www.jboss.org/products/fuse.html

    • www.redhat.com/products/jbossenterprisemiddleware/fuse/